1. Field of the Invention
The present invention relates to a printing apparatus connected to a host computer to execute printing according to a command from the host computer, and a printing apparatus used in a data processing apparatus such as a Point-of-Sale (POS) terminal and an electronic cash register (ECR) used for monetary transactions. More particularly, the invention relates to a printing apparatus capable of converting a general command to a real-time command, easily expanding the real-time command, and a control method therefor and a data processing apparatus using the printing apparatus.
2. Description of the Related Art
In general, printing apparatus such as those connected to a personal computer to print documents or pictures, and those provided in a data processing apparatus such as a POS terminal and ECR used in monetary transactions in a store to print receipts, execute operations including printing according to print data and command data transmitted from a host computer (including a personal computer).
FIG. 1 illustrates a basic configuration of a printing apparatus which includes an interface 1 for receiving print or command data from a host computer or transmitting data to the host computer; a memory 2 for storing various types of data; a printer driver 4 for driving the mechanics of the printing apparatus such as a printer head 6, a motor 7, and a flange part 8; a sensor 5 for sensing the state of the printing apparatus; and a Central Processing Unit (CPU) 3 for checking the state of the printing apparatus from an output signal of the sensor 5 and controlling the operation of the printer driver 4 according to data or command transmitted from the host computer.
In the meantime, while using a printing apparatus, there may be errors like the printing apparatus being out of paper or the cover is opened and so forth. When such an error occurs, a conventional printing apparatus stops its operation and brings the interface 1 connected to the host computer into an off-line state, and thus the host computer cannot continue to transmit data. At this point, because internal control of the printing apparatus stops, the data already received is not processed and there is no response from the printing apparatus to the command of the host computer.
In this case, the host computer displays that an error has occurred and interrupts its operation, maintaining this state until the user manually corrects the problem and brings the printing apparatus to an on-line state.
Therefore, there have been many inconveniences in recovering from the printing errors in the past, and no other work could be processed until the error was corrected. In particular, in the case of an ECR or a POS terminal, the printing operation is connected to the entire operation of the ECR or the POS terminal, causing inconveniences for the customers as well.
In addition, the conventional printing apparatus processes a control command by First-In-First-Out (FIFO) method, which creates a considerable time lag between output of the command from the host computer and actual execution of the command by the printing apparatus.
To overcome such a problem, U.S. Pat. No. 5,594,653 proposes a printing apparatus which distinguishes between a command to be processed at real time (hereinafter referred to as “real-time command”) and a command to be processed in the order of so that the real-time commands can be processed first. FIG. 2 is a functional block diagram illustrating the printing apparatus disclosed in the above U.S. Pat. No. 5,594,653.
With reference to FIG. 2, in this prior art printing apparatus, when the host computer 10 transmits command data, print data and other information to the printing apparatus, this data and information is received by a data receiving means 11 and transmitted to a real-time command interpreting means 13. The real-time command interpreting means 13 interprets the command such that if it is a real-time command, transmits the command to a real-time execution means 22 to execute the command, and if it is not a real-time command, passes the command to be stored in a receive buffer 14.
In addition, a command interpreter 15 reads and interprets the commands stored in the receive buffer 14 in the order stored to distinguish between the command data for controlling the printing apparatus and the print data. The print data is stored in a print buffer 16 and the command data is transmitted to a control means 17. The control means 17 controls each functional block according to the command data transmitted from the command interpreter 15. For example, if the command transmitted from the command interpreter 15 is a print command, the control means 17 reads the data stored in the print buffer 16, controlling the print driver 19 to print a corresponding print pattern.
Real-time commands transmitted from the real-time interpreting means 13 to the real-time processing means 22 are designated at the time of designing, and may include, for example, a status request command, etc. Information on the errors, the paper, the cover, the switch and other status information sensed by a plurality of detectors 20 which detect the state of peripheral devices is stored in a status memory 23. Therefore, when a status request command is received, the real-time processing means 22 retrieves the status information from the status memory 23 and transmits it to the host computer 10 through a data transmission means 12.
Even if an error occurs, this printing apparatus continues to operate the data receiving means 11, the data transmission means 12, the real-time command interpreter 13 and the real-time processor 22 to enable data transmission and reception. This allows the printing apparatus provided with the POS terminal or the ECR to detect the state of the cash drawer by detecting the state of the peripheral devices. And by using the real-time command requesting status information as described above, the printing apparatus allows the user or manager to be able to check immediately whether the cash drawer is opened or locked.
In addition, the above-described printing apparatus includes an error recovery command as a real-time command so that when an error occurs, error information is deleted and printing operation is resumed without deleting the data stored in the receive buffer 14 and the print buffer 16.
However, in this prior art printing apparatus, real-time commands and general commands are distinguished at the time of designing, and thus a general command cannot be changed to a real-time command while using the printing apparatus. Thus, all possible situations with the printing apparatus need to be predicted in advance to establish the corresponding real-time commands.
Moreover, in general, a printing apparatus conducts various functions including cutting paper, transferring paper, printing, controlling peripheral devices (e.g. cash drawer, display), and the like. These functions are basically processed by general commands, but some need to be processed by real-time commands depending on the needs. For example, when an error occurs with the printing apparatus provided with the ECR, the cash drawer needs to be opened and closed at real time so as to prevent too much wait for the customer. But at usual times, the cash drawer needs to be opened and closed in the order of FIFO. Therefore, a command (e.g. control command of cash drawer) needs to be processed as a real-time command or a general command depending on the situation. However, it is difficult to predict these kinds of situations at the time of designing, and even if it is possible, the same command needs to be set as either a real-time command or a general command for different situations. This increases the number of commands and complicates the control structure of the printing apparatus, thereby causing inconveniences for the customers in turn.